#年份分布

import pandas as pd

from pyecharts import options as opts
from pyecharts.charts import Pie
from pyecharts.faker import Faker

df=pd.read_csv("二手车基本信息.csv")
df.head()
df['年份'].value_counts().values.tolist()
year_num =df['年份'].value_counts().values.tolist()
year_type=df['年份'].value_counts().index.tolist()



c = (
    Pie()
    .add("", [list(z) for z in zip(year_type, year_num)])
    .set_global_opts(title_opts=opts.TitleOpts(title="年份分布"))
    .set_series_opts(label_opts=opts.LabelOpts(formatter="{b}: {c}"))
    .render("bigdata/cardata/年份分布.html")
)